################################################################################
##                                                                            ##
##  Title         : Replication file for "Realists and Idealists in QCA"      ##
##                  Political Analysis, forthcoming                           ##
##  Author        : Carsten Q. Schneider (schneiderc@ceu.edu)                 ##
##  Date          : 13.11.2017                                                ##
##                                                                            ##
##  R version     : >=3.4.1                                                   ##
##  QCA version   : 2.6                                                       ##
##  SetMethods v. : 2.1                                                       ##
################################################################################

# The data files and the following lines 22-61 and 499-561 are taken from the replication 
# file from: Thiem, Alrik, 2016, "Replication Data for: Standards of Good Practice and
# the Methodology of Necessary Conditions in Qualitative Comparative Analysis", 
# doi:10.7910/DVN/BCQM3Y, Harvard Dataverse, V1, lines 18-28, 34-55, and 257-321.


# download  the data files into one folder and set that folder as your working directory

# load datasets into list
studies <- paste0(c("Avdagic2010", "BankEtal2015", "BasedauRichter2014",
                    "CebotariVink2013", "DaRoitWeicht2013", "DavidssonEmmenegger2013",
                    "Emmenegger2011", "EppleEtal2014", "Fischer2015", "HamidovEtal2015",
                    "IshiyamaBatta2012", "Karlas2012", "Lilliefeldt2012", "Mello2012",
                    "Metelits2009", "PahlWostlKnieper2014", "Palm2013", "ParkYoung2015",
                    "SchneiderMakszin2014", "Thomann2015", "VerweijEtal2013"), "set.tab")

dat <- vector("list", length(studies))
dat <- lapply(studies, read.table, row.names = 1, header = 1)
names(dat) <- c("AVD","BAN","BAS","CEB","DAR","DAV","EMM","EPP","FIS","HAM","ISH",
                "KAR","LIL","MEL","MET","PAH","PAL","PAR","SCH","THO","VER")

fctrsAVD <- c("MAAS", "UNEM", "DENS", "CENT", "MEDC", "LEFT", "MING", "EFFP")
fctrsDAR <- c("EXPSERV", "PRIV", "EXPCASHFREE", "WORKMIG", "UNDOCMIG",
              "LOWSKILLMIG", "UNDERECON")
fctrsPAH <- c("COR", "DIS", "LEG", "CPI", "GDP")


# data from Ragin, Charles C. 2009. "Qualitative Comparative Analysis Using Fuzzy
# Sets (fsQCA)." In Configurational Comparative Methods: Qualitative Comparative
# Analysis (QCA) and Related Techniques, ed. B. Rihoux and C. C. Ragin. London:
# Sage Publications, p.95.

LIP <- data.frame(
  D = c(0.81,0.99,0.58,0.16,0.58,0.98,0.89,0.04,0.07,
        0.72,0.34,0.98,0.02,0.01,0.01,0.03,0.95,0.98),
  U = c(0.12,0.89,0.98,0.07,0.03,0.03,0.79,0.09,0.16,
        0.05,0.10,1.00,0.17,0.02,0.03,0.30,0.13,0.99),
  L = c(0.99,0.98,0.98,0.98,0.99,0.99,0.99,0.13,0.88,
        0.98,0.41,0.99,0.59,0.01,0.17,0.09,0.99,0.99),
  I = c(0.73,1.00,0.90,0.01,0.08,0.81,0.96,0.36,0.07,
        0.01,0.47,0.94,0.00,0.11,0.00,0.21,0.67,1.00),
  G = c(0.43,0.98,0.91,0.91,0.58,0.95,0.31,0.43,0.13,
        0.95,0.58,0.99,0.00,0.01,0.84,0.20,0.91,0.98),
  S = c(0.05,0.95,0.89,0.12,0.77,0.95,0.05,0.06,0.42,
        0.92,0.05,0.95,0.12,0.05,0.21,0.06,0.95,0.95)
)

rownames(LIP) <- c("AT","BE","CZ","EE","FI","FR","DE","GR","HU",
                   "IE","IT","NL","PL","PT","RO","ES","SE","UK")

# load QCA and SetMethods packages
library(QCA); library(SetMethods)

### Lipset data #######

# Table 1: Most parsimonious solution, outcome S
sol_yp <- eqmcc(LIP, outcome = "S", conditions = c("D", "U", "L", "I", "G"), 
                incl.cut = 0.8,
                include = "?", 
                details = TRUE,
                show.cases = FALSE)
sol_yp

# Table 2: Supersets, outcome S
SUIN_S <- superSubset(LIP, outcome = "S", relation = 'nec', incl.cut = 0.9, use.tilde = TRUE)
SUIN_S

# demonstration of simultaneous superset relation, disjunctions D+~U and ~U+I
SUIN_NS <- superSubset(LIP, outcome = "~S", relation = 'nec', incl.cut = 0.9, use.tilde = TRUE)
SUIN_NS

intersect(names(SUIN_S$coms), names(SUIN_NS$coms)) 

# Disjunctions D+~U and ~U + I are consistent supersets for both S and ~S. 
# This is why RoN is low and these disjunctions should
# not be interpreted as a necessary condition for outcome either S or ~S.


# Visualization (xy plots) of each superset
for (i in (1:length(SUIN_S$coms))) 
{ xy.plot(SUIN_S$coms[,i], LIP$S, necessity = TRUE, case.lab = TRUE, labs = rownames(LIP), xlab = colnames(SUIN_S$coms)[i])}
# no cases in the area X < .5 and Y > .5
# three expressions (X) with all cases  X > .5


### Fischer data ######

# demonstration that the output of function superSubset returns an expression that, when
# interpreted as the product of sums, yields the empty set. 

SUIN_FIS <- superSubset(dat$FIS, outcome = "DOM", incl.cut = 0.75)
SUIN_FIS

# To include a proof using sop():
sop("(~EUR + ~OPEN)(EUR + OPEN)(~FED + ~OPEN)(~FED + OPEN)(~FED + ~EUR)(FED + ~OPEN)(FED + ~EUR)(FED + EUR)")
# [1] ""


### Meta-analysis #### 
# Deriving the most parsimonious solution formula for 21 data sets used in Thiem (2016)
# for the outcome and its negation, with consistency thresholds 0.9 and 0.75, respectively.
# See online supplementary material for a summary of the results.

# 1. Avdagic (2010)
AVD_09 <- eqmcc(dat$AVD, outcome = "SOCP",
                conditions = fctrsAVD[c(1,2,5,7)], 
                incl.cut = 0.9,
                include = "?",
                details = TRUE,
                all.sol = TRUE)
AVD_09

AVD_075 <- eqmcc(dat$AVD, outcome = "SOCP",
                 conditions = fctrsAVD[c(1,2,5,7)], 
                 incl.cut = 0.75,
                 include = "?",
                 details = TRUE,
                 all.sol = TRUE)
AVD_075

AVD_09n <- eqmcc(dat$AVD, outcome = "~SOCP",
                 conditions = fctrsAVD[c(1,2,5,7)], 
                 incl.cut = 0.9,
                 include = "?",
                 details = TRUE,
                 all.sol = TRUE)
AVD_09n

AVD_075n <- eqmcc(dat$AVD, outcome = "~SOCP",
                  conditions = fctrsAVD[c(1,2,5,7)], 
                  incl.cut = 0.75,
                  include = "?",
                  details = TRUE,
                  all.sol = TRUE)
AVD_075n

# 2. Bank, Richter, and Sunik (2015)
BAN_09 <- eqmcc(dat$BAN, outcome = "Y", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
BAN_09

BAN_075 <- eqmcc(dat$BAN, outcome = "Y", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
BAN_075

BAN_09n <- eqmcc(dat$BAN, outcome = "~Y", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
BAN_09n

BAN_075n <- eqmcc(dat$BAN, outcome = "~Y", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
BAN_075n

# 3. Basedau and Richter (2014)
BAS_09 <- eqmcc(dat$BAS, outcome = "CWO", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
BAS_09

BAS_075 <- eqmcc(dat$BAS, outcome = "CWO", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
BAS_075

BAS_09n <- eqmcc(dat$BAS, outcome = "~CWO", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
BAS_09n

BAS_075n <- eqmcc(dat$BAS, outcome = "CWO", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
BAS_075n

# 4. Cebotari and Vink (2013)
CEB_09 <- eqmcc(dat$CEB, outcome = "PROTEST", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
CEB_09

CEB_075 <- eqmcc(dat$CEB, outcome = "PROTEST", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
CEB_075

CEB_09n <- eqmcc(dat$CEB, outcome = "~PROTEST", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
CEB_09n

CEB_075n <- eqmcc(dat$CEB, outcome = "~PROTEST", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
CEB_075n

# 5. Da Roit and Weicht (2013)
DAR_09 <- eqmcc(dat$DAR, conditions = fctrsDAR, outcome = "MIGFAM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
DAR_09

DAR_075 <- eqmcc(dat$DAR, conditions = fctrsDAR, outcome = "MIGFAM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
DAR_075

DAR_09n <- eqmcc(dat$DAR, conditions = fctrsDAR, outcome = "~MIGFAM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
DAR_09n

DAR_075n <- eqmcc(dat$DAR, conditions = fctrsDAR, outcome = "~MIGFAM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
DAR_075n

# 6. Davidsson and Emmenegger (2013)
DAV_09 <- eqmcc(dat$DAV, outcome = "TWOTIER", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
DAV_09

DAV_075 <- eqmcc(dat$DAV, outcome = "TWOTIER", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
DAV_075

DAV_09n <- eqmcc(dat$DAV, outcome = "~TWOTIER", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
DAV_09n

DAV_075n <- eqmcc(dat$DAV, outcome = "~TWOTIER", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
DAV_075n

# 7. Emmenegger (2011)
EMM_09 <- eqmcc(dat$EMM, outcome = "JSR", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
EMM_09

EMM_075 <- eqmcc(dat$EMM, outcome = "JSR", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
EMM_075

EMM_09n <- eqmcc(dat$EMM, outcome = "~JSR", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
EMM_09n

EMM_075n <- eqmcc(dat$EMM, outcome = "~JSR", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
EMM_075n

# 8. Epple, Gasser, Kersten, Nollert and Schief (2014)
EPP_09 <- eqmcc(dat$EPP, outcome = "D", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
EPP_09

EPP_075 <- eqmcc(dat$EPP, outcome = "D", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
EPP_075

EPP_09n <- eqmcc(dat$EPP, outcome = "~D", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
EPP_09n

EPP_075n <- eqmcc(dat$EPP, outcome = "~D", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
EPP_075n

# 9. Fischer (2015)
FIS_09 <- eqmcc(dat$FIS, outcome = "DOM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
FIS_09

FIS_075 <- eqmcc(dat$FIS, outcome = "DOM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
FIS_075

FIS_09n <- eqmcc(dat$FIS, outcome = "~DOM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
FIS_09n # no row above threshold

FIS_075n <- eqmcc(dat$FIS, outcome = "~DOM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
FIS_075n

# 10. Hamidov, Thiel and Zikos (2015)
HAM_09 <- eqmcc(dat$HAM, outcome = "MIC", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
HAM_09

HAM_075 <- eqmcc(dat$HAM, outcome = "MIC", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
HAM_075

HAM_09n <- eqmcc(dat$HAM, outcome = "~MIC", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
HAM_09n # no row above threshold

HAM_075n <- eqmcc(dat$HAM, outcome = "~MIC", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
HAM_075n

# 11. Ishiyama and Batta (2012)
ISH_09 <- eqmcc(dat$ISH, outcome = "DPS", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
ISH_09

ISH_075 <- eqmcc(dat$ISH, outcome = "DPS", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
ISH_075

ISH_09n <- eqmcc(dat$ISH, outcome = "~DPS", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
ISH_09n

ISH_075n <- eqmcc(dat$ISH, outcome = "~DPS", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
ISH_075n

# 12. Karlas (2012)
KAR_09 <- eqmcc(dat$KAR, outcome = "CONT", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
KAR_09

KAR_075 <- eqmcc(dat$KAR, outcome = "CONT", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
KAR_075

KAR_09n <- eqmcc(dat$KAR, outcome = "~CONT", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
KAR_09n

KAR_075n <- eqmcc(dat$KAR, outcome = "~CONT", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
KAR_075n

# 13. Lilliefeldt (2012)
LIL_09 <- eqmcc(dat$LIL, outcome = "BALANCE", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
LIL_09 # PI chart too large

LIL_075 <- eqmcc(dat$LIL, outcome = "BALANCE", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
LIL_075 # PI chart too large

LIL_09n <- eqmcc(dat$LIL, outcome = "~BALANCE", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
LIL_09n # PI chart too large

LIL_075n <- eqmcc(dat$LIL, outcome = "~BALANCE", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
LIL_075n # PI chart too large

# 14. Mello (2012)
MEL_09 <- eqmcc(dat$MEL, outcome = "MP", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
MEL_09

MEL_075 <- eqmcc(dat$MEL, outcome = "MP", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
MEL_075

MEL_09n <- eqmcc(dat$MEL, outcome = "~MP", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
MEL_09n

MEL_075n <- eqmcc(dat$MEL, outcome = "~MP", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
MEL_075n

# 15. Metelits (2009)
MET_09 <- eqmcc(dat$MET, outcome = "COERCE", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
MET_09

MET_075 <- eqmcc(dat$MET, outcome = "COERCE", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
MET_075

MET_09n <- eqmcc(dat$MET, outcome = "~COERCE", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
MET_09n

MET_075n <- eqmcc(dat$MET, outcome = "~COERCE", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
MET_075n

# 16. Pahl-Wostl and Knieper (2014)
PAH_09 <- eqmcc(dat$PAH, outcome = "ADAP", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAH_09 # PI chart too large

PAH_075 <- eqmcc(dat$PAH, outcome = "ADAP", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAH_075

PAH_09n <- eqmcc(dat$PAH, outcome = "~ADAP", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAH_09n

PAH_075n <- eqmcc(dat$PAH, outcome = "~ADAP", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAH_075n

# 17. Palm (2013)
PAL_09 <- eqmcc(dat$PAL, outcome = "IWS", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAL_09

PAL_075 <- eqmcc(dat$PAL, outcome = "IWS", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAL_075

PAL_09n <- eqmcc(dat$PAL, outcome = "~IWS", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAL_09n

PAL_075n <- eqmcc(dat$PAL, outcome = "~IWS", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAL_075n

# 18. Park and Young (2015)
PAR_09 <- eqmcc(dat$PAR, outcome = "WM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAR_09

PAR_075 <- eqmcc(dat$PAR, outcome = "WM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAR_075

PAR_09n <- eqmcc(dat$PAR, outcome = "~WM", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
PAR_09n

PAR_075n <- eqmcc(dat$PAR, outcome = "~WM", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
PAR_075n

# 19. Schneider and Makszin (2014)
SCH_09 <- eqmcc(dat$SCH, outcome = "LPI", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
SCH_09

SCH_075 <- eqmcc(dat$SCH, outcome = "LPI", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
SCH_075

SCH_09n <- eqmcc(dat$SCH, outcome = "~LPI", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
SCH_09n # no row above threshold

SCH_075n <- eqmcc(dat$SCH, outcome = "~LPI", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
SCH_075n # no row above threshold

# 20. Thomann (2015)
THO_09 <- eqmcc(dat$THO, outcome = "PERF", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
THO_09

THO_075 <- eqmcc(dat$THO, outcome = "PERF", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
THO_075

THO_09n <- eqmcc(dat$THO, outcome = "~PERF", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
THO_09n # no row above threshold

THO_075n <- eqmcc(dat$THO, outcome = "~PERF", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
THO_075n

# 21. Verweij, Klijn, Edelenbos and Van Buuren (2013)
VER_09 <- eqmcc(dat$VER, outcome = "O", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
VER_09

VER_075 <- eqmcc(dat$VER, outcome = "O", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
VER_075 # all rows above threshold

VER_09n <- eqmcc(dat$VER, outcome = "~O", incl.cut = 0.9, include = "?", details = TRUE, all.sol = TRUE)
VER_09n

VER_075n <- eqmcc(dat$VER, outcome = "~O", incl.cut = 0.75, include = "?", details = TRUE, all.sol = TRUE)
VER_075n

#### Lipset data, different necessity claims, different solution formulas #### 

# Table 3: ESA solution formulas, outcome S

# most parsimonious

tt_S <- truthTable(LIP, outcome = "S", conditions = c("D", "U", "L", "I", "G"), 
                incl.cut = 0.8,
                n.cut = 1,
                details = TRUE,
                sort.by = c('OUT', 'incl'),
                show.cases = FALSE,
                complete = TRUE)

tt_S

# most parsimonious solution
print(sol_S_p <- eqmcc(tt_S, include = "?", details = TRUE))

# conservative solution
print(sol_S_c <- eqmcc(tt_S, details = TRUE))

### ESA most parsimonious solutions based on different necessity claims ####

# a) D+U+I <- S
print(tt_S_D_U_I <- esa(oldtt = tt_S, nec_cond = "D+U+I"))

print(sol_S_D_U_I <- eqmcc(tt_S_D_U_I, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*~I + U*G => S

# b) L <- S
print(tt_S_L <- esa(oldtt = tt_S, nec_cond = "L"))

print(sol_S_L <- eqmcc(tt_S_L, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*L*~I + U*L*G => S

# c) G <- S
print(tt_S_G <- esa(oldtt = tt_S, nec_cond = "G"))

print(sol_S_G <- eqmcc(tt_S_G, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: U*G + D*~I*G => S

# d) LG <- S
print(tt_S_LG <- esa(oldtt = tt_S, nec_cond = c("L", "G")))

print(sol_S_LG <- eqmcc(tt_S_LG, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: U*L*G + D*L*~I*G => S


### Solutions based on each consistent enough superset ----

# 4) D+~U <- S
print(tt_S_DnU <- esa(oldtt = tt_S, nec_cond = c("D+~U")))

print(sol_S_DnU <- eqmcc(tt_S_DnU, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*~I + U*G => S
# NB: identical to most parsimonious solution

# 5) D+~I <- S
print(tt_S_DnI <- esa(oldtt = tt_S, nec_cond = c("D+~I")))

print(sol_S_DnI <- eqmcc(tt_S_DnI, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*~I + (U*I*G) => S 
# M2: D*~I + (D*U*G) => S 

# 6) D+~G <- S
print(tt_S_DnG <- esa(oldtt = tt_S, nec_cond = c("D+~G")))

print(sol_S_DnG <- eqmcc(tt_S_DnG, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*~I + U*G => S
# NB: identical to most parsimonious solution

# 7) ~U+I <- S
print(tt_S_nUI <- esa(oldtt = tt_S, nec_cond = c("~U+I")))

print(sol_S_nUI <- eqmcc(tt_S_nUI, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: U*G + D*L*~I*G => S

# 10) D+~L+I <- S
print(tt_S_DnLI <- esa(oldtt = tt_S, nec_cond = c("D+~L+I")))

print(sol_S_DnLI <- eqmcc(tt_S_DnLI, include = "?", use.tilde = TRUE, all.sol = TRUE))
# M1: D*~I + (U*L*G) => S 
# M2: D*~I + (U*I*G) => S 
# M3: D*~I + (D*U*G) => S 



### References for meta analysis ####

# 1.  Avdagic, Sabina. 2010. When are concerted reforms feasible? Explaining the
#       emergence of social pacts in Western Europe. Comparative Political
#       Studies 43(5):628-57.
# 2.  Bank, Andr?, Thomas Richter, and Anna Sunik. 2015. Long-term monarchical
#       survival in the Middle East: A configurational comparison, 1945-2012.
#       Democratization 22(1):179-200.
# 3.  Basedau, Matthias, and Thomas Richter. 2014. Why do some oil exporters
#       experience civil war but others do not? Investigating the conditional
#       effects of oil. European Political Science Review 6(4):549-74.
# 4.  Cebotari, Victor, and Maarten P. Vink. 2013. A configurational analysis of
#       ethnic protest in Europe. International Journal of Comparative Sociology
#       54(4):298-324.
# 5.  Da Roit, Barbara, and Bernhard Weicht. 2013. Migrant care work and care,
#       migration and employment regimes: A fuzzy-set analysis. Journal of
#       European Social Policy 23(5):469-486.
# 6.  Davidsson, Johan B., and Patrick Emmenegger. 2013. Defending the
#       organisation, not the members: Unions and the reform of job security
#       legislation in Western Europe. European Journal of Political Research
#       52(3):339-63.
# 7.  Emmenegger, Patrick. 2011. Job security regulations in Western Democracies:
#       A fuzzy set analysis. European Journal of Political Research 50(3):336-64.
# 8.  Epple, Ruedi, Martin Gasser, Sarah Kersten, Michael Nollert, and Sebastian
#       Schief. 2014. Institutions and gender time inequality: A fuzzy-set QCA
#       of Swiss cantons. Swiss Journal of Sociology 40(2):259-78.
# 9.  Fischer, Manuel. 2015. Institutions and coalitions in policy processes: A
#       cross-sectoral comparison. Journal of Public Policy 35(2):245-68.
# 10. Hamidov, Ahmad, Andreas Thiel, and Dimitrios Zikos. 2015. Institutional
#       design in transformation: A comparative study of local irrigation
#       governance in Uzbekistan.? Environmental Science & Policy 53(0):175-91.
# 11. Ishiyama, John, and Anna Batta. 2012. The emergence of dominant political
#       party systems in unrecognized states. Communist and Post-Communist Studies
#       45(1-2):123-30.
# 12. Karlas, Jan. 2012. National parliamentary control of EU affairs:
#       Institutional design after enlargement. West European Politics
#       35(5):1095-113.
# 13. Lilliefeldt, Emelie. 2012. ?Party and gender in Western Europe revisited:
#       A fuzzy-set Qualitative Comparative Analysis of gender-balanced parliamentary
#       parties. Party Politics 18(2):193-214.
# 14. Mello, Patrick A. 2012. Parliamentary peace or partisan politics? Democracies?
#       participation in the Iraq War. Journal of International Relations and
#       Development 15(3):420-53.
# 15. Metelits, Claire M. 2009. The consequences of rivalry: Explaining insurgent
#       violence using fuzzy sets. Political Research Quarterly 62(4):673-84.
# 16. Pahl-Wostl, Claudia, and Christian Knieper. 2014. The capacity of water
#       governance to deal with the climate change adaptation challenge: Using
#       fuzzy set Qualitative Comparative Analysis to distinguish between polycentric,
#       fragmented and centralized regimes. Global Environmental Change 29:139-54.
# 17. Palm, Trineke. 2013. Embedded in social cleavages: An explanation of the
#       variation in timing of women?s suffrage. Scandinavian Political Studies
#       36(1):1-22.
# 18. Park, Sung H., and Kevin L. Young. 2015. Wage moderation in the public
#       sector: The experiences of 11 EMU countries in the recent economic crisis,
#       2008?2010. Economic and Industrial Democracy 36(4):575-609.
# 19. Schneider, Carsten Q., and Kristin Makszin. 2014. Forms of welfare capitalism
#       and education-based participatory inequality. Socio-Economic Review
#       12(2):437-62.
# 20. Thomann, Eva. 2015. Is output performance all about the resources? A fuzzy-set
#       Qualitative Comparative Analysis of street-level bureaucrats in Switzerland.
#       Public Administration 93 (1):177-94.
# 21. Verweij, Stefan, Erik-Hans Klijn, Jurian Edelenbos, and Arwin Van Buuren.
#       2013. What makes governance networks work? A fuzzy set Qualitative
#       Comparative Analysis of 14 Dutch spatial planning projects. Public
#       Administration 91(4):1035-55.
